<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>绘制俩条线</title>
</head>
<body>

   <canvas id="myCanvas" width="200" height="100"
    style="border: 1px solid darkgrey">
    </canvas>

    <script type="text/javascript">
        var c = document.getElementById("myCanvas");
        var cxt = c.getContext("2d");
        cxt.moveTo(20,20);
        cxt.lineTo(160,60);
        cxt.lineTo(10,50);
        cxt.stroke();
    </script>
</body>
</html>